<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial - scale=1.0">
    <link rel="stylesheet" href="../static/css/behindManager.css" th:href="@{/css/behindManager.css}">
    <link rel="stylesheet" href="../static/css/iconfont.css" th:href="@{/css/iconfont.css}">
    <link rel="stylesheet" href="../static/css/confirm.css" th:href="@{/css/confirm.css}">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <title>类别管理</title>
</head>
<body>
<div class="box">
    <div class="nav-container">
        <div class="logo">
            <img src="../static/img/logo.png" alt="Ant Design Pro" th:src="@{/img/logo.png}">
            <p class="name">Haven Manager</p>
        </div>
        <div class="user-info">
            <span class="username">后台管理</span>
        </div>
        <ul class="nav">
            <li><a href="http://localhost:8080/admin/behindManagerUser" th:href="@{/admin/behindManagerUser}"  data-target="adminManagement" class="nav-link ">用户管理</a></li>
            <li><a href="http://localhost:8080/admin/behindManagerPost" th:href="@{/admin/behindManagerPost}" data-target="systemManagement" class="nav-link ">帖子管理</a></li>
            <li><a href="http://localhost:8080/admin/behindManagerCategory" th:href="@{/admin/behindManagerCategory}" data-target="kindManagement" class="nav-link active">类别管理</a></li>
            <li><a href="http://localhost:8080/admin/behindManagerReport" th:href="@{/admin/behindManagerReport}" data-target="jubaoManager" class="nav-link">举报管理</a></li>
        </ul>
    </div>
<a href="http://localhost:8080/mainPageRecommend" th:href="@{/mainPageRecommend}" style="position: static"><button class="back" style="z-index: 100">返回首页</button></a>
<a href="" class="person"><img src="../static/img/image1.png " alt=""  th:src="${admin.avatar}" >
    <div class="admin-name"  th:text="${admin.username}">烧饼</div></a>
    <div id="kindManagement" class="content">
        <button id="check-button">全部删除</button>
        <button id="addButton1" class="add-button">添加</button>
        <input type="text" id="check" class="checked" placeholder="请输入类别名称">
        <button id="checkkey-button" class="add-button">查询</button>
        <div><i class="iconfont" id="backform" >&#xe61b;</i></div>
        <table class="adminManagement-table">
            <thead>
            <tr>
                <th><input type="checkbox" class="selectAll"></th>
                <th>类别</th>
                <th>内容</th>
                <th>操作</th>
            </tr>
            </thead>
            <div>
                <p id="notice" style="position: absolute;top: 300px;left: 400px;font-size: 22px;font-weight: 700; display: none">没有找到该类别</p>
            </div>
            <tbody id="categoryList">
            <tr th:each="cate: ${categoryList}">
                <td><input type="checkbox" class="rowCheckbox" th:value="${cate.id}"  th:data-id="${cate.id}"></td>
                 <td th:text="${cate.name}"></td>
                <td>
                    <div class="contents" th:text="${cate.description}"  style="  max-width: 170px;"></div>
                </td>
                <td>
                    <button class="editbtn text-xl" th:data-id="${cate.id}">编辑</button>
                    <button class="deletebtn" th:data-id="${cate.id}">删除</button>
                </td>
            </tr>
            </tbody></table>
        <div class="pagination" id="pageNav"></div>
    </div>
    <!-- 类别编辑 -->
    <div id="categoryEditModal" class="modal" style="display: none;">
        <div class="bg">
            <div class="title-edit">编辑栏</div>
            <label for="categoryKindInput" class="lable4" style="top:176px">类别为：<input type="text" id="categoryKindInput" class="postTitle" placeholder="类别" maxlength="20"></label>
            <label class="lable3" style="top: 260px">内容为：</label>
            <div id="categoryEditPostContentDiv" class="border border-gray-300 p-2 rounded-md w-full h-32 mb-2"
                 style="overflow-y: auto; white-space: pre-line; margin-top: 269px;" contenteditable="true"></div>
            <button class="saveEditPost " id="categoryEditModalSaveButton"  style="margin-left: 198px;">保存</button>
            <button class="cancelEditPost">取消</button>
        </div>
    </div>
    <div>
<div id="addModal1" class="addModal" style="display: none">
    <div class="bg1">
        <div class="title-edit">添加栏</div>
        <label for="categoryKindInput" class="lable4" style="top:176px ">类别为：<input type="text" id="categoryKindInput1" class="postTitle" placeholder="类别" maxlength="20"></label>
        <div id="categoryNameError" style="top: 185px; margin-left: 366px; color: red; font-size: 13px;position: absolute; width: 200px;"></div>
        <label class="lable3" style="top: 260px">内容为：</label>
        <div id="categoryEditPostContentDiv1" class="border border-gray-300 p-2 rounded-md w-full h-32 mb-2"
             style="overflow-y: auto; white-space: pre-line; margin-top: 269px;" contenteditable="true"></div>
        <div id="categoryContentError" style="top: 268px; margin-left: 640px; color: red; font-size: 13px;position: absolute; width: 200px;"></div>
        <button class="saveEditPost " id="categoryEditModalSaveButton1"  style="margin-left: 198px;">保存</button>
        <button class="cancelEditPost1" style="top: 605px">取消</button></ul></div></div></div>   </div>
<script src="../static/js/behindManagercatory.js" th:src="@{/js/behindManagercatory.js}"></script>
    <script th:inline="javascript">
        let posts = [[${categoryList}]];
        console.log(posts)
    </script>
</body>

</html>